package cn.changeforyou.base.exception;

import cn.changeforyou.base.model.ResultInfo;

/***
 * 将返回json格式的异常
 */
public class JsonException extends RuntimeException{
    private int code;
    private String message;

    private transient ResultInfo resultInfo;

    public JsonException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public JsonException() {
    }

    public JsonException(ErrorInfo info) {
        super(info.getMessage());
        this.code = info.getCode();
        this.message = info.getMessage();
        this.resultInfo = info;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public ResultInfo getResultInfo() {
        return resultInfo;
    }
}
